/**
 * Copyright 2009-2011 xiaonei.com All right reserved.
 * This software is the confidential and proprietary information of Xiaonei.com ("Confidential Information"). 
 * You shall not disclose such Confidential Information and shall use it only in accordance with the terms of the license agreement you entered into with Xiaonei.com.
 * Create by XiaoNeiAntiSpamTeam
 *
 */

package com.xiaonei.test.reflect;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

/**
 * @ClassName: Main
 * @Description: TODO
 * @author shaohui.liu shaohui.liu@opi-corp.com
 * @date Mar 24, 2010 12:34:23 PM
 * 
 */
public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader buf = new BufferedReader(new InputStreamReader(new FileInputStream(args[0]),
                "utf-8"));
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out, "utf-8"));
        String line = "اعترهي هي من اليمين إلى اليسار من حسنا";
        //String line = "00:00:14,968 - {content=[回复۩ 黄丹 ღ:大粑粑是你…我不是…], fromId=249717853, result=0, time=0, method=filter, clientIp=10.3.18.200:56537, checkType=32}";
        while ((line = buf.readLine()) != null) {
            boolean flag = false;
            String content = line.substring(line.indexOf("content=[") + 9,
                    line.indexOf("fromId=") - 3);

            for (int i = 0; i < content.length(); i++) {
                char ch = content.charAt(i);
                //维吾尔语
                if (ch >= 0x0600 && ch <= 0x06FF) {
                    flag = true;
                    break;
                }
                if (ch >= 0xFB50 && ch <= 0xFDFF) {
                    flag = true;
                    break;
                }
                if (ch >= 0xFE70 && ch <= 0xFEFF) {
                    flag = true;
                    break;
                }
            }
            if (flag) {
                writer.write(line + "\n");
            }
        }
        writer.flush();
        writer.close();
        buf.close();
    }
}
